<template>
	<view>
		<!-- banner -->
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">{{list_data.name}}</view>
			</view>
			<u-swiper :list="list_data.images_text" height="187" autoplay radius="0"></u-swiper>
		</view>
		<!-- 内容 -->
		<view class="mainpadding">
			<view class="titletext textcenter">请选择诉讼请求
				<text class="huisetext1">（可多选）</text>
			</view>
			<view class=" margin_top" :class="item.ischeck?'yixuanze':'weixianz'" v-for="item in zly_list" :key="item.id" @click="changeitem(item)">{{item.name}}</view>
		</view>
		<!-- 固定底部 -->
		<view class="gudingdb mainpadding ffffff" @click="tzxyb">
			<view class="bigbtn">下一步</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				zly_list: [],
				list_data: {},
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.msg));
			this.list_data = data
			uni.setNavigationBarTitle({
				title: data.name
			});
			this.getzly()
		},
		methods: {
			changeitem(item){
				item.ischeck=item.ischeck?false:true;
			},
			getzly() { //诉讼理由
				httpRequest.request('/api/index/sspgTypeChildIndex', 'GET', {
					id:this.list_data.id
				}).then(res => {
					res.data.forEach(item=>{
						this.$set(item,"ischeck",false)
					})
					this.zly_list = res.data
				})
			},
			// 跳转下一步填写案情事实
			tzxyb() {
				let data = {
					sspg_type_ids:"",
					sspg_type_id:this.list_data.id,
				}
				let arr = []
				this.zly_list.forEach(item=>{
					if(item.ischeck){
						arr.push(item.id)
					}
				})
				if(arr.length==0){
					httpRequest.toast("请选择诉讼请求！")
					return false
				}
				data.sspg_type_ids = arr.join()
				uni.navigateTo({
					url: '/pages/index/tianxieaqss?msg='+ encodeURIComponent(JSON.stringify(data))
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.yixuanze {
		background-color: #F4FBFF;
		border-radius: 40rpx;
		width: 100%;
		height: 65rpx;
		display: flex;
		border: 1rpx solid #007AFF;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		color: #007AFF;
		font-weight: 500;
	}

	.weixianz {
		background-color: #F8F8F8;
		border-radius: 40rpx;
		width: 100%;
		height: 65rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		color: #333;
		font-weight: 500;
		border: 1rpx solid #F8F8F8;
	}

	.fudongdw {
		position: absolute;
		bottom: 68rpx;
		left: 36%;
	}
</style>